
const path = require('path')
const htmlWebpackPlugin = require('html-webpack-plugin')
var TransformModulesPlugin = require('webpack-transform-modules-plugin')
module.exports = {
    entry: "./src/main.js",
    output: {
        path: path.join(__dirname, 'dist'),
        filename: "bundle.js"
    },
    plugins: [
        new htmlWebpackPlugin({
            template: path.join(__dirname, 'src/index.html'),
            filename: "index.html"
        }),
        new TransformModulesPlugin()
    ],
    module: {
        rules: [
            { test: /\.css$/, use: ['style-loader', 'css-loader'] },
            { test: /\.(jpg|png|gif|bmp|jpeg)$/, use: "url-loader" },
            { test: /\.(ttf|eot|svg|woff|woff2)$/, use: ["url-loader"] },
            { test: /\.js$/, use: 'babel-loader', exclude: /node_modules/ },
            //limit=xxx ,当文件的字节超过xxx，则不会转换为base64格式的字符，如果
            //小于xxx值则会被转换 name=[name].[text],[hash:8]....[hash]-[name].[text]

            { test: /\.vue$/, use: "vue-loader" },
            {
                test: /\.scss$/,
                loaders: ['style-loader', 'css-loader', 'sass-loader'],
                exclude: /node_modules/ 
            }
        ]
    },
    resolve: {
        alias: {
            // "vue$":"vue/dist/vue.js"
            'cube-ui': 'cube-ui/lib'
        }
    },

}